<%-- $RCSFile: PageLayout.aspx $
 Apache license v2 2011 by Christian Surieux
 $Source: ?/AddonNice/PageModules/Pages/PageLayout.aspx $
 $log$
 Revision 6 2010/08/09 10:51:22  christian.surieux
   Added Log comment to all .aspx .ascx .master files
 --%>
<%@ Page Language="c#" AutoEventWireup="False" Inherits="AddonNice.PageModules.Pages.PageLayout"
    Codebehind="PageLayout.aspx.cs" MasterPageFile="~/MasterPages/ADNProperties.Master" %>
<%@ Import Namespace="AddonNice.Settings" %>
<%@ Register Assembly="Telerik.Web.UI"   TagPrefix="Telerik" Namespace="Telerik.Web.UI" %>
<%@ Register assembly="ADNCRM.Core" tagPrefix="cnf" namespace="AddonNice.Configuration" %>
<%@ Register assembly="ADNCRM.Core" tagprefix="uc1" namespace="AddonNice.UI.WebControls" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentTitle" runat="server">
    <asp:Literal ID="tab_name" runat="server" Text="<%$ Resources:ADNCRM,AM_TABNAME %>" />
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolderButtons2" runat="server">
    <asp:PlaceHolder ID="PlaceHolderButtons2" runat="server" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentSettingsTable" runat="server">
    <asp:ScriptManagerProxy ID="SCMPPageLayout" runat='server' />
    <Telerik:radformdecorator id="FormDecorator1" runat="server"  DecorationZoneID="decor1" />
    <Telerik:radformdecorator id="Formdecorator2" runat="server"  DecorationZoneID="decor2" />

    <div style="margin-left:auto; margin-right:auto; width:100%;">
    <table id='Table1' cellspacing="0" cellpadding="0" width='100%'>
    <tr valign='top'>
        <td style="float:left; width:100%;">
            <Telerik:RadTabStrip ID="RadTabStrip1" Align="Left" runat="server" MultiPageID="RadMultiPage1" Width="100%" ReoderTabsOnSelect="false">
                <Tabs>
                    <Telerik:RadTab Text="<%$ Resources:ADNCRM,PAGESETTINGS_GENPARAM %>" PageViewID="Pageview1" />
                    <Telerik:RadTab Text="<%$ Resources:ADNCRM,PAGESETTINGS_LAYOUT %>" PageViewID="Pageview2" />
                    <Telerik:RadTab Text="<%$ Resources:ADNCRM,PAGESETTINGS_PARAMETERS %>" PageViewID="Pageview3" />
                </Tabs>
            </Telerik:RadTabStrip>
        </td>
    </tr>
    <tr valign='top'>
        <td style="float:left; width:100%;">
        <Telerik:RadMultiPage ID="RadMultiPage1" SelectedIndex="0" runat="server" style="margin-left:auto; margin-right:auto; width:100%;" >
            <Telerik:RadPageView ID="Pageview1" Width='100%'  runat="server">
                <fieldset id="Fieldset1" class='SettingsTableFieldSet' runat="server">
                    <legend id="legend"  class='SettingsTableLegend' runat="server">
                        <asp:Literal ID="Lit1" Text="<%$ Resources:ADNCRM,PAGESETTINGS_GENPARAM %>" runat="server" />
                    </legend>
                    <table  class='SettingsTableGroup' cellspacing="1" cellpadding="2" border="0" width="100%" style="margin-left:auto; margin-right:auto; width:100%;">
                        <tr class='SettingsTableRow' >
                            <td class='SettingsTableCell' style="width: 5%;">
                                <asp:image ID="Image4" runat='server' SkinID="Buttons_Help" AlternateText="<%$ Resources:ADNCRM,AM_TABID1|Id %>" />
                            </td>
                            <td class='SettingsTableCell' style="width: 25%;">
                                <asp:Literal ID="Literal5" runat="server" Text="<%$ Resources:ADNCRM,AM_TABID|Id %>" />
                            </td>
                            <td class='SettingsTableCell' style="width: 70%;">
                                <asp:Label ID="LblTabID" runat="server" Width="95%"  />
                            </td>
                        </tr>
                        <tr class='SettingsTableRow' >
                            <td class='SettingsTableCell' style="width: 5%;">
                                <asp:image ID="Image0" runat='server' SkinID="Buttons_Help" AlternateText="<%$ Resources:ADNCRM,AM_TABNAME1 %>" />
                            </td>
                            <td class='SettingsTableCell' style="width: 25%;">
                                <asp:Literal ID="tab_name1" runat="server" Text="<%$ Resources:ADNCRM,AM_TABNAME1 %>" />
                            </td>
                            <td class='SettingsTableCell' style="width: 70%;">
                                <asp:TextBox ID="tabName" runat="server" Width="95%" MaxLength="47" />
                            </td>
                        </tr>
                        <tr class='SettingsTableRow' >
                            <td class='SettingsTableCell' style="width: 5%;">
                                <asp:image ID="Image5" runat='server' SkinID="Buttons_Help" AlternateText="<%$ Resources:ADNCRM,AM_SYSTEMPRPOERTIES1|System %>" />
                            </td>
                            <td class='SettingsTableCell' style="width: 25%;">
                                <asp:Literal ID="Literal6" runat="server" Text="<%$ Resources:ADNCRM,AM_SYSTEMPRPOERTIES|System %>" />
                            </td>
                            <td class='SettingsTableCell' style="width: 70%;">
                            <asp:CheckBoxList ID='ClbFlags' runat="server" RepeatColumns='3' CssClass='EnhancedBorder'  />
                            </td>
                        </tr>
                        <tr class='SettingsTableRow' >
                            <td class='SettingsTableCell' style="width: 5%;">
                                <asp:image ID="Image6" runat='server' SkinID="Buttons_Help" AlternateText="<%$ Resources:ADNCRM,AM_TABURL1|Url %>" />
                            </td>
                            <td class='SettingsTableCell' style="width: 25%;">
                                <asp:Literal ID="Literal7" runat="server" Text="<%$ Resources:ADNCRM,AM_TABURL|Url %>" />
                            </td>
                            <td class='SettingsTableCell' style="width: 70%;">
                                <asp:Label ID="LblPageUrl" runat="server" Width="95%"  />
                            </td>
                        </tr>
                        <tr class='SettingsTableRow' >
                            <td class='SettingsTableCell' style="width: 5%;">
                                <asp:image ID="Image1" runat='server' SkinID="Buttons_Help" AlternateText="<%$ Resources:ADNCRM,AM_TABIMAGE %>" />
                            </td>
                            <td class='SettingsTableCell' style="width: 25%;">
                                <asp:Literal ID="Literal3" runat="server" Text="<%$ Resources:ADNCRM,AM_TABIMAGE %>" />
                            </td>
                            <td class='SettingsTableCell' style="width: 70%;">
                                <Telerik:RadComboBox ID="DDLPageImage" runat="server" Width="300px" DataTextField="Key" DataValueField="Value" />
                            </td>
                        </tr>
                        <tr class='SettingsTableRow' >
                            <td class='SettingsTableCell' style="width: 5%;">
                                <asp:image ID="Image2" runat='server' SkinID="Buttons_Help" AlternateText="<%$ Resources:ADNCRM,AM_ROLESAUTH %>" />
                            </td>
                            <td class='Settin160gsTableCell' style="width: 25%;">
                                <asp:Literal Text="<%$ Resources:ADNCRM,AM_ROLESAUTH %>" ID="roles_auth" runat="server" />
                            </td>
                            <td class='SettingsTableCell' style="width: 70%;">
                                <div id="decor1">
                                    <asp:CheckBoxList ID="authRoles" runat="server" Width="95%" RepeatColumns="2" />
                                </div>
                            </td>
                        </tr>
                        <tr class='SettingsTableRow' >
                        <td class='SettingsTableCell' style="width: 5%;">
                            <asp:image ID="Image3" runat='server' SkinID="Buttons_Help" AlternateText="<%$ Resources:ADNCRM,TAB_PARENT %>" />
                        </td>
                        <td class='SettingsTableCell' style="width: 25%;">
                             <asp:Literal ID="page_parent" runat="server" Text="<%$ Resources:ADNCRM,TAB_PARENT %>" />
                        </td>
                        <td class='SettingsTableCell' style="width: 70%;">
                            <uc1:RadTreeComboPages ID="parentPage" runat="server" Width="300px" />
                            <asp:Label ID="lblErrorNotAllowed" runat="server" Text="<%$ Resources:ADNCRM,ERROR_NOT_ALLOWED_PARENT %>"
                                    CssClass="Error" EnableViewState="False" Visible="False" />
                        </td>
                        </tr>
                    </table>
                </fieldset>
            </Telerik:RadPageView>
            <Telerik:RadPageView ID="Pageview2" Width='100%' runat="server">
                <fieldset id="Fieldset2" class='SettingsTableFieldSet' runat="server">
                    <legend id="legend1"  class='SettingsTableLegend' runat="server">
                        <asp:Literal ID="Literal1" Text="<%$ Resources:ADNCRM,PAGESETTINGS_LAYOUT %>" runat="server" />
                    </legend>
                    <table class='SettingsTableGroup' cellspacing="0" cellpadding="0" border="0" width='100%' >
                        <tr>
                            <td>
                                <asp:Literal ID="addmodule" runat="server" Text="<%$ Resources:ADNCRM,AM_ADDMODULE %>" />
                            </td>
                            <td>
                                <asp:Literal ID="module_type" runat="server" Text="<%$ Resources:ADNCRM,AM_MODULETYPE %>" />
                            </td>
                            <td>
                                <uc1:RadTreeComboModules ID="moduleType" runat="server" style='width:250px;' Height='400' />
                            </td>
                            <td>
                                <asp:Literal ID="Literal4" runat="server" Text="Units" />&nbsp;&nbsp;&nbsp;
						        <Telerik:RadComboBox ID="RadComboUnit" runat="server" Width='100px' >
                                    <Items>
                                        <Telerik:RadComboBoxItem Value="0" Text="Pixel" />
                                        <Telerik:RadComboBoxItem Value="1" Text="%" />
                                    </Items>
                                </Telerik:RadComboBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                                <asp:Literal ID="moduleLocationLabel" runat="server" Text="<%$ Resources:ADNCRM,AM_MODULELOCATION %>" />
                            </td>
                            <td valign="top">
                                <Telerik:RadComboBox ID="paneLocation" runat="server" style='width:250px;' >
                                    <Items>
                                        <Telerik:RadComboBoxItem Value="LeftPane" Text="<%$ Resources:ADNCRM,AM_MODULELOCATION_LEFT %>" />
                                        <Telerik:RadComboBoxItem Value="ContentPane" Selected="True" Text="<%$ Resources:ADNCRM,AM_MODULELOCATION_CENTER %>" />
                                        <Telerik:RadComboBoxItem Value="RightPane" Text="<%$ Resources:ADNCRM,AM_MODULELOCATION_RIGHT %>" />
                                    </Items>
                                </Telerik:RadComboBox>
                            </td>
                            <td></td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                                <asp:Literal ID="moduleVisibleLabel" runat="server" Text="<%$ Resources:ADNCRM,AM_MODULEVISIBLETO %>" />
                            </td>
                            <td>
                                <Telerik:RadComboBox ID="viewPermissions" runat="server" style='width:250px;'/>
                            </td>
                            <td>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                                <asp:Literal ID="module_name" runat="server" Text="<%$ Resources:ADNCRM,AM_MODULENAME %>" />
                            </td>
                            <td>
                            <Telerik:RadTextBox ID="moduleTitle"  runat="server" EmptyMessage="<%$ Resources:ADNCRM,AM_NEWMODULENAME %>"  style='width:250px;' />
                                &nbsp;
                             <asp:ImageButton ID="AddModuleBtn" SkinID="AddModule" runat="server" AlternateText="<%$ Resources:ADNCRM,AM_ADDMODULEBELOW %>"  style='position:relative; top:2px;'/>
						    </td>
						    <td>                                            
			                  <asp:ImageButton id="previewBtn"  SkinID="Preview_" AlternateText="<%$ Resources:ADNCRM,PREVIEW %>" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4">
                                <hr />
                            </td>
                        </tr>
                        <tr valign="top">
                            <td colspan='4'>
                            <div style="width:100%; min-width:800px;  height:430px; margin-left:auto ;margin-right:auto;" >
                            <asp:Panel ID='Panel1' runat='server'>
                                <div style="width:100%; min-width:800px;  height:30px; margin-left:auto ;margin-right:auto;position:relative;" >
                                    <Telerik:RadNumericTextBox ID="TbLWidth"  runat="server" NumberFormat-DecimalDigits='0' ShowButton="true"  
                                                ClientEvents-OnButtonClick="ButtonClick" AutoPostBack="true" width='33%'/>
                                    <Telerik:RadNumericTextBox ID="TbCWidth"  runat="server" NumberFormat-DecimalDigits='0' ShowButton="true"  
                                                 ClientEvents-OnButtonClick="ButtonClick" AutoPostBack="true" width='33%'/>
                                    <Telerik:RadNumericTextBox ID="TbRWidth"  runat="server" NumberFormat-DecimalDigits='0' ShowButton="true"  
                                                 ClientEvents-OnButtonClick="ButtonClick" AutoPostBack="true" width='33%'/>
                                </div>
                                <Telerik:raddocklayout runat="server" id="RadDockLayout1" >
                                    <telerik:RadSplitter id="RadSplitter1" runat="server" height="400px" width="800px">
                                        <telerik:RadPane id="RadPane1" runat="server" width="260px" MinWidth="10" Scrolling="None" OnClientResized="PaneResized">
                                            <Telerik:RadDockZone runat="server" id="RadDockZone1" CssClass="DockZ"  />
                                        </telerik:RadPane>
                                        <telerik:RadSplitBar id="RadSplitbar1" runat="server" CollapseMode="None" />
                                        <telerik:RadPane id="RadPane2" runat="server" width="260px" MinWidth="10" Scrolling="None" OnClientResized="PaneResized">
                                            <telerik:RadDockZone ID="RadDockZone2" runat="server" CssClass="DockZ" />
                                        </telerik:RadPane>
                                        <telerik:RadSplitBar id="RadSplitBar2" runat="server" CollapseMode="None" />
                                        <telerik:RadPane id="RadPane3" runat="server" Width='260px' MinWidth="10" Scrolling="None" OnClientResized="PaneResized" >
                                            <telerik:RadDockZone ID="RadDockZone3" runat="server" CssClass="DockZ" />
                                        </telerik:RadPane>
                                    </telerik:RadSplitter>
                                    <div style="display:none">
                                    <asp:Panel runat="server" id="Panel2" />
                                    </div> 
                                </Telerik:raddocklayout>
                            </asp:Panel>
                            </div>
                             </td>
                        </tr>
                        <tr>
                            <td align="center" colspan="4">
                                <asp:Label ID="msgError" CssClass="Error" runat="server" Text="" EnableViewState='false' />
                            </td>
                        </tr>
                    </table>
                </fieldset>
            </Telerik:RadPageView>
            <Telerik:RadPageView ID="Pageview3" Width='100%' runat="server">
                <fieldset id="Fieldset3" class='SettingsTableFieldSet' runat="server">
                    <legend id="legend2"  class='SettingsTableLegend' runat="server">
                        <asp:Literal ID="Literal2" Text="<%$ Resources:ADNCRM,PAGESETTINGS_PARAMETERS %>"
                            runat="server" />
                    </legend>
                    <table class='SettingsTableGroup' cellspacing="1" cellpadding="2" border="0" width='100%'>
                        <tr>
                            <td>
                            <div id="decor2" >
                                <cnf:SettingsTable ID="EditTable"  TableType='Page' Orientation="VerticalLeft" Width='100%' runat="server" />
                            </div>
                            </td>
                        </tr>
                    </table>
                </fieldset>
            </Telerik:RadPageView>
        </Telerik:RadMultiPage>
        </td>
    </tr>
    </table>
    </div>
    <script type="text/javascript">
        function ajustWdt(sender, tb, pn, pn2, val, wdt, tp) {
            var ow = pn.get_width();
            if (tp == '1')
                ow = (100 * ow) / 780;
            var ow2 = tb.get_value();
            var dif = ow - val;
            var now2 = ow2 + dif;
            var modif = false;
            while (now2 < 0) {
                dif++;
                val--;
                modif = true;
                now2 = ow2 + dif;
            }
            tb.set_value(now2);
            if (tp == '1') {
                pn2.set_width((780 * now2) / 100);
            }
            else pn2.set_width(ow2 - dif);
            pn.set_width(wdt);
            if (modif) {
                wdt = (780 * val) / 100;
                sender.set_value(val);
            }
            return modif;
        }


        function ButtonClick(sender, e) {
            var id = sender.get_id();
            var val = sender.get_value();
            var tp = $find("<%=RadComboUnit.ClientID%>").get_value();
            var wdt = val;
            if (tp == '1')
                wdt = (780 * val) / 100;
            var modif = false;
            if (id == "<%=TbLWidth.ClientID%>") {
                var pn = $find("<%=RadPane1.ClientID%>");
                var tb = $find("<%=TbCWidth.ClientID%>");
                var pn2 = $find("<%=RadPane2.ClientID%>");
                modif = ajustWdt(sender, tb, pn, pn2, val, wdt, tp)
            }
            else if (id == "<%=TbCWidth.ClientID%>") {
                var pn = $find("<%=RadPane2.ClientID%>");
                var tb = $find("<%=TbRWidth.ClientID%>");
                var pn2 = $find("<%=RadPane3.ClientID%>");
                modif = ajustWdt(sender, tb, pn, pn2, val, wdt, tp)
            }
            else {
                var pn = $find("<%=RadPane3.ClientID%>");
                var tb = $find("<%=TbCWidth.ClientID%>");
                var pn2 = $find("<%=RadPane2.ClientID%>");
                modif = ajustWdt(sender, pn, tb, pn2, val, wdt, tp)
            }
            if (!modif) {
                var radTextBox = sender;
                radTextBox.raisePostBackEvent();
            }
        }

        function PaneResized(sender, eventArgs) {
            var id = sender.get_id();
            var wdt = sender.get_width();
            var tp = $find("<%=RadComboUnit.ClientID%>").get_value();
            var pct = wdt;
            if (tp == '1')
                pct = (wdt * 100) / 780;
            if (id == "<%=RadPane1.ClientID%>")
                $find("<%=TbLWidth.ClientID%>").set_value(pct);
            else if (id == "<%=RadPane2.ClientID%>")
                $find("<%=TbCWidth.ClientID%>").set_value(pct);
            else
                $find("<%=TbRWidth.ClientID%>").set_value(pct);
        }
    </script>  
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolderButtons1" runat="server">
    <asp:PlaceHolder ID="PlaceHolderButtons" runat="server"></asp:PlaceHolder>
</asp:Content>
